#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    this->move(0,900-300-100);
    this->setWindowTitle("运行");
    ui->confirmButton->setEnabled(false);
    connect(ui->inputlineEdit,SIGNAL(returnPressed()),this,SLOT(on_confirmButton_clicked()));
    this->connect(ui->inputlineEdit,SIGNAL(textChanged(QString)),this,SLOT(setButtonEnable()));
}

MainWindow::~MainWindow(){

}

void MainWindow::on_confirmButton_clicked()
{
    QString startString= ui->inputlineEdit->text();
    QProcess *myProcess = new QProcess();
    myProcess->start(startString.trimmed());
    ui->inputlineEdit->clear();
    this->close();
}

void MainWindow::setButtonEnable() {
    qDebug()<<"aa";
    ui->confirmButton->setEnabled(true);
}
